import { defineStore } from 'pinia'
import { operateLogList } from '../utils/trueType'
export const useOperateLogListStore = defineStore('operateLogList', {
    state: () => ({
        operateLog: [] as operateLogList[],
        loading: false,
        pageNum: 1,
        pageSize: 5,
        total: 0,
        selectedIds: <string[]>([]),
    }),
    actions: {
        setOperateLog(data: operateLogList[]) {
            this.operateLog = data
        },
        changeLoading(){
            this.loading = !this.loading
            setTimeout(() => {
                this.loading = !this.loading
            }, 500);
        },
        addSelectedIds(id: string) {
            if (this.selectedIds.includes(id)) {
                this.selectedIds.splice(this.selectedIds.indexOf(id), 1)
            } else {
                this.selectedIds.push(id)
            }
        },
    },
    getters: {
        
    },
}
)